package com.seeyon.apps.restext;

import java.util.HashMap;
import java.util.Map;
import java.util.List;
import java.util.ArrayList;
import com.seeyon.client.CTPRestClient;

public class RestCultureDemorestsample111  {

//单位讨论板块列表(Since:V61)
public static void testGetBbsTypeByUnitId() {
   CTPRestClient client = ClientResource.getInstance().resouresClent();
   String result = client.get("bbs/bbsType/unit/6067420384799049360?pageSize=20&pageNo=1", String.class);
   System.out.println(result);
   System.out.println("我是一条结果");
}

//集团讨论板块列表(Since:V61)
public static void testGetGroupBbsType() {
   CTPRestClient client = ClientResource.getInstance().resouresClent();
   String result = client.get("bbs/bbsType/group?pageSize=20&pageNo=1" ,String.class);
   System.out.println(result);
}

//讨论列表(指定板块)(Since:V61)
public static void testGetBbsListByTypeId() {
   CTPRestClient client = ClientResource.getInstance().resouresClent();
   String result =client.get("bbs/bbsType/{boardId}/{loginName}?pageSize=20&pageNo=1", String.class);
   System.out.println(result);
}

//讨论列表(指定单位)(Since:V61)
public static void testGetBbsListByUnitId() {
   CTPRestClient client = ClientResource.getInstance().resouresClent();
   String result = client.get("bbs/unit/{unitId}/{loginName}?pageSize=20&pageNo=1", String.class);
   System.out.println(result);
}

//创建讨论(Since:V61)
public static void testCreatBbs() {
   Map res = new HashMap();
   res.put("memberId", "");//发起人ID
   res.put("boardId", "");//板块id bbs_board表ID
   res.put("custom", "");
   res.put("spaceId", "");
   res.put("DEPARTMENTAffiliateroomFlag", "");
   res.put("articleName", "");//讨论题目
   res.put("content", "<p>正文内容</p><img style=\"width: 1436px; height: 723px;\" alt=\"\" src=\"/seeyon/fileUpload.do?method=showRTE&amp;fileId=5455480607471714894&amp;createDate=2017-04-07&amp;type=image\">");//正文
   res.put("resourceFlag", "0");
   res.put("issueArea", "Account|{id}");//发布范围

   CTPRestClient client = ClientResource.getInstance().resouresClent();
   String result = client.post("bbs" ,res, String.class);
   System.out.println(result);
}

//单位调查板块列表(Since:V61)
public static void testGetInquiryTypeByUnitId() {
   CTPRestClient client = ClientResource.getInstance().resouresClent();
   String result = client.get("inquiry/inquiriesType/unit/{unitId}?pageSize=20&pageNo=1", String.class);
   System.out.println(result);
}

//集团调查板块列表(Since:V61)
public static void testGetGroupInquiryType() {
   CTPRestClient client = ClientResource.getInstance().resouresClent();
   String result = client.get("inquiry/inquiriesType/group?pageSize=20&pageNo=1" , String.class);
   System.out.println(result);
}

//调查列表(指定板块)(Since:V61)
public static void testGetInquiryTypeByTypeId() {
   CTPRestClient client = ClientResource.getInstance().resouresClent();
   String result = client.get("inquiry/inquiriesType/{boardId}/{loginName}?pageSize=20&pageNo=1", String.class);
   System.out.println(result);
}

//调查列表(指定单位)(Since:V61)
public static void testGetInquiryListByUnitId() {
   CTPRestClient client = ClientResource.getInstance().resouresClent();
   String result = client.get("inquiry/unit/{unitId}/{loginName}?pageSize=20&pageNo=1" , String.class);
   System.out.println(result);
}

//创建调查(Since:V61)
public static void testCreatInquiry() {
   Map res = new HashMap();
   res.put("createUserId", "");//调查发起人
   res.put("surveytypeId", "");//调查类型 inquiry_surveytype表
   res.put("surveyname", "");//调查标题
   res.put("surveydesc", "");//调查描述
   res.put("cryptonym", "1");//调查是否实名
   res.put("allowViewResult", "true");//调查是否允许查看调查结果
   res.put("allowViewResultAhead", "false");//调查是否允许提交前看调查结果
   res.put("allowAdminViewResult", "true");//调查发起人/版块管理员查看已投票和未投票人
   res.put("questionSort", "0,1");//调查问题的个数
   res.put("question0Title", "调查题目1");//调查问题0题目
   res.put("question0Desc", "");//调查问题0描述
   res.put("question0SingleOrMany", "0");//调普问题0的形式
   res.put("question0Discuss", "1");//调查问题0讨论
   res.put("question0OtherItem", "1");//调查问题0题目列表
   res.put("question0Item", "不是,肯定不是");//讨论题目
   res.put("question1Title", "调查题目2");//调查问题1题目
   res.put("question1Desc", "单选题目2");//调查问题1描述
   res.put("question1SingleOrMany", "0");//调普问题1的形式
   res.put("question1Discuss", "1");//调查问题1讨论
   res.put("question1OtherItem", "1");//调查问题1题目列表
   res.put("question1Item", "对,太对了");
   res.put("scopeId", "Account|{id}");//发布范围

   CTPRestClient client = ClientResource.getInstance().resouresClent();
   String result = client.post("inquiry" ,res, String.class);
   System.out.println(result);
}

public static void main(String args[]){
   testGetBbsTypeByUnitId();
//   testGetGroupBbsType();
//   testGetBbsListByTypeId();
//   testGetBbsListByUnitId();
//   testCreatBbs();
//
//   testGetInquiryTypeByUnitId();
//   testGetGroupInquiryType();
//   testGetInquiryTypeByTypeId();
//   testGetInquiryListByUnitId();
//   testCreatInquiry();
}
}